package com.caoji.serach.web;

import com.caoji.serach.service.EsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("goods")
public class SearchController {

    @Autowired
    EsService EsService;


    /**
     * 初始化索引库
     */
    @GetMapping("initialization")
    public ResponseEntity<String> init() {
        EsService.createIndexAndMapping();
        EsService.loadData();
        return ResponseEntity.ok("导入成功");
    }


}